package com.swjd.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.jdbc.SQL;
import org.springframework.web.bind.annotation.RequestParam;

import com.swjd.pojo.Home;

public class SQLProvider {

	public static String select(@Param("rname")String rname) {
		return new SQL() {
			{
				SELECT("*");
				FROM("home");
				if (rname != null) {
					WHERE("rname like concat('%',#{rname},'%')");
				}
				
			}
		}.toString();
	}
	
	public static String selcon(@Param("pricestart")String pricestart,@Param("priceend")String priceend) {
		return new SQL() {
			{
				SELECT("*");
				FROM("home");
					if (pricestart !=null && !pricestart.equals("") ) {
						WHERE("price >=#{pricestart} and price <= #{priceend}");
					}
				
			}
		}.toString();
	}
}
